﻿using System;

class Program
{
    static void Main(string[] args)
    {
        var clock = new Clock();

        // 注册 Tick 事件处理程序
        clock.Tick += (sender, e) =>
        {
            Console.WriteLine("滴答: " + DateTime.Now.ToString("HH:mm:ss"));
        };

        // 注册 Alarm 事件处理程序
        clock.Alarm += (sender, e) =>
        {
            Console.WriteLine("叮铃铃！现在是 " + DateTime.Now.ToString("HH:mm:ss") + ", 时间到了！");
        };

        Console.WriteLine("请输入闹钟设置时间（格式：HH:mm:ss）:");
        string alarmTimeString = Console.ReadLine();
        var alarmTime = DateTime.Today.Add(TimeSpan.Parse(alarmTimeString));

        // 设置闹钟时间
        clock.SetAlarm(alarmTime);

        // 启动闹钟
        clock.Start();

        Console.WriteLine("闹钟已启动，按任意键退出...");
        Console.ReadKey();
    }
}